﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model_SSResourceManager;

namespace Presenter_SSResourceManager
{
    public class PresenterEditResource
    {
        private readonly IViewEditResource _viewEditResource;
        private readonly ModelsManager _mModel;

        public PresenterEditResource(IViewEditResource view)
        {
            _viewEditResource = view;
            _mModel = ModelInstanse.Get();

        }

        public void FillFieldToEdit()
        {
            var id = _viewEditResource.GetResourceId();
            _viewEditResource.FillPageFields(_mModel.resourceModel.Get(id));
        }

        public void Update()
        {
            _mModel.resourceModel.Update(_viewEditResource.GatherPageFieldsInformation());
        }
    }
}
